cap log close

global path = "****"

local name= "extra_months"  
local date = "110519"
global logname = "$path/`name'_`date'.log"

clear
set more off
cd "$path"
log using "$logname", replace

use "$path/Data/penalty_sample.dta", clear



forval m=1/24 {
	cap drop months_`m'_or_more
	gen months_`m'_or_more = covered1718 >=`m'
}

estimates clear
eststo clear
local est_name = "$path/`name'_4564_`date'"
cap erase "`est_name'.ster"
forval m=1/24 {
	reg months_`m'_or_more treatment if covered2016-any_dec~=11 & age_2017<65 & age_2017>=45, cl(tin)
	eststo
	estadd scalar nobs e(N)
	summ `e(depvar)' if e(sample)&treatment==0
	estadd scalar ymean=r(mean)*100
	estimates save "`est_name'", append
}

log close

